\section{user\_\-handler::web\_\-handler Class Reference}
\label{classuser__handler_1_1web__handler}\index{user_handler::web_handler@{user\_\-handler::web\_\-handler}}
This class handles all messages from the web-client.  


{\tt \#include $<$web\_\-handler.h$>$}

Inheritance diagram for user\_\-handler::web\_\-handler::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3cm]{classuser__handler_1_1web__handler}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
\bf{web\_\-handler} (boost::shared\_\-ptr$<$ \bf{network::i\_\-socket} $>$ s, boost::shared\_\-ptr$<$ \bf{network::i\_\-socket} $>$ micro, boost::shared\_\-ptr$<$ \bf{music::music\_\-system} $>$ mu, boost::shared\_\-ptr$<$ \bf{network::connection\_\-manager} $>$ mgr)
\begin{CompactList}\small\item\em \doxyref{web\_\-handler}{p.}{classuser__handler_1_1web__handler} creates the \doxyref{web\_\-handler}{p.}{classuser__handler_1_1web__handler}. Never call this constructor directly, use the create-method instead. \item\end{CompactList}\item 
virtual \bf{$\sim$web\_\-handler} ()\label{classuser__handler_1_1web__handler_1b2afbdbeb0bd53287d59dfcc58d1abe}

\item 
virtual void \bf{handle\_\-event} (boost::shared\_\-ptr$<$ \bf{network::message} $>$ n)
\begin{CompactList}\small\item\em handle\_\-event handles all received events from a web-client. \item\end{CompactList}\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static boost::shared\_\-ptr$<$ \bf{user\_\-handler::web\_\-handler} $>$ \bf{create} (boost::shared\_\-ptr$<$ \bf{network::i\_\-socket} $>$ sock, boost::shared\_\-ptr$<$ \bf{network::i\_\-socket} $>$ control, boost::shared\_\-ptr$<$ \bf{music::music\_\-system} $>$ music, boost::shared\_\-ptr$<$ \bf{network::connection\_\-manager} $>$ mgr)
\begin{CompactList}\small\item\em create creates a new \doxyref{web\_\-handler}{p.}{classuser__handler_1_1web__handler} object. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
This class handles all messages from the web-client. 



Definition at line 44 of file web\_\-handler.h.

\subsection{Constructor \& Destructor Documentation}
\index{user_handler::web_handler@{user\_\-handler::web\_\-handler}!web_handler@{web\_\-handler}}
\index{web_handler@{web\_\-handler}!user_handler::web_handler@{user\_\-handler::web\_\-handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}user\_\-handler::web\_\-handler::web\_\-handler (boost::shared\_\-ptr$<$ \bf{network::i\_\-socket} $>$ {\em s}, boost::shared\_\-ptr$<$ \bf{network::i\_\-socket} $>$ {\em micro}, boost::shared\_\-ptr$<$ \bf{music::music\_\-system} $>$ {\em mu}, boost::shared\_\-ptr$<$ \bf{network::connection\_\-manager} $>$ {\em mgr})\hspace{0.3cm}{\tt  [inline]}}\label{classuser__handler_1_1web__handler_396d33c9c2afbfa07dacc685e7420b39}


\doxyref{web\_\-handler}{p.}{classuser__handler_1_1web__handler} creates the \doxyref{web\_\-handler}{p.}{classuser__handler_1_1web__handler}. Never call this constructor directly, use the create-method instead. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em s}]is the socket to the web-client \item[{\em micro}]is the socket to the microcontroller \item[{\em mu}]is a pointer to the music-system \item[{\em mgr}]is a pointer to the connection-manager. \end{description}
\end{Desc}


Definition at line 55 of file web\_\-handler.h.

\begin{Code}\begin{verbatim}59                 : _sock(s), _controller(micro), _music(mu), _mgr(mgr) {}
\end{verbatim}\end{Code}




\subsection{Member Function Documentation}
\index{user_handler::web_handler@{user\_\-handler::web\_\-handler}!create@{create}}
\index{create@{create}!user_handler::web_handler@{user\_\-handler::web\_\-handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}static boost::shared\_\-ptr$<$\bf{user\_\-handler::web\_\-handler}$>$ user\_\-handler::web\_\-handler::create (boost::shared\_\-ptr$<$ \bf{network::i\_\-socket} $>$ {\em sock}, boost::shared\_\-ptr$<$ \bf{network::i\_\-socket} $>$ {\em control}, boost::shared\_\-ptr$<$ \bf{music::music\_\-system} $>$ {\em music}, boost::shared\_\-ptr$<$ \bf{network::connection\_\-manager} $>$ {\em mgr})\hspace{0.3cm}{\tt  [inline, static]}}\label{classuser__handler_1_1web__handler_2e1dc759900f0c0e513c0c406c70243c}


create creates a new \doxyref{web\_\-handler}{p.}{classuser__handler_1_1web__handler} object. 

\begin{Desc}
\item[See also:]\doxyref{web\_\-handler}{p.}{classuser__handler_1_1web__handler} \end{Desc}


Definition at line 75 of file web\_\-handler.h.

\begin{Code}\begin{verbatim}80                 {
81                         boost::shared_ptr<user_handler::web_handler> ptr(
82                                 new user_handler::web_handler(sock, control, 
83                                         music, mgr));
84                         ptr->_this = ptr;
85                         return ptr;
86                 }
\end{verbatim}\end{Code}


\index{user_handler::web_handler@{user\_\-handler::web\_\-handler}!handle_event@{handle\_\-event}}
\index{handle_event@{handle\_\-event}!user_handler::web_handler@{user\_\-handler::web\_\-handler}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void user\_\-handler::web\_\-handler::handle\_\-event (boost::shared\_\-ptr$<$ \bf{network::message} $>$ {\em n})\hspace{0.3cm}{\tt  [virtual]}}\label{classuser__handler_1_1web__handler_f02d811d6d40dcaf559c31355b26fbac}


handle\_\-event handles all received events from a web-client. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em n}]is a pointer to the received message. \end{description}
\end{Desc}


Implements \bf{handler::event\_\-handler} \doxyref{p.}{classhandler_1_1event__handler_7ff75131a32fb17cf4addc4581344bff}.

Definition at line 5 of file web\_\-handler.cpp.

\begin{Code}\begin{verbatim}7 {
8         if(n->type == network::RECEIVE) {
9                 boost::shared_ptr<model::dom> node(n->node);
10                 // TODO: Refactor this!!
11                 if(node->name() == "play") {
12                         do_play(node);
13                 } else if(node->name() == "list") {
14                         do_list(node);
15                 } else if(node->name() == "pause") {
16                         do_pause(node);
17                 } else if(node->name() == "list_temp") {
18                         do_temp(node);
19                 } else if(node->name() == "light") {
20                         do_light(node);
21                 } else if(node->name() == "tv") {
22                         do_tv(node);
23                 }
24         } else if(n->type == network::DELETE) {
25                 boost::shared_ptr<user_handler::web_handler> tmp(_this.lock());
26                 fire_listener();
27         }
28 }
\end{verbatim}\end{Code}




The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
user\_\-handler/web\_\-handler.h\item 
user\_\-handler/web\_\-handler.cpp\end{CompactItemize}
